<template>
  <fieldset>
    <legend>商城</legend>
    <h1>商品列表</h1>
    <ul>
      <li v-for="(item, i) in list" :key="i" @click="clickFn(item.productId)">
        <!-- <router-link :to="{ path: `/particulars/productId=${item.productId}` }">
          {{ item.productName }}
        </router-link> -->
        <!-- <router-link :to="{ path: `/particulars/${item.productId}` }"> -->
        {{ item.productName }}
        <!-- </router-link> -->
      </li>
    </ul>
  </fieldset>
</template>
<script>
import router from "@/router";

export default {
  data() {
    return {
      list: "",
    };
  },
  methods: {
    clickFn(i) {
      this.$router.push({ path: "/particulars", query: { particulars: i } });
    },
  },
  mounted() {
    fetch("http://chst.vip:1234/api/getmoneyctrl")
      .then((body) => body.json())
      .then((res) => {
        this.list = res.result;
      });
  },
  components: { router },
};
</script>
<style lang="scss" scoped>
* {
  padding-left: 20px;
}
</style>
